class PlayerVo extends DataVo {
    //当前平台
    channel: string;
    //code
    code: string;
    //版本号
    version: string;


    //玩家游戏中的唯一标识
    uid: string;
    //玩家的平台开放编号
    openid: string;
    //玩家昵称
    nick: string;
    //玩家性别
    sex: number = 0;
    //玩家头像链接
    pic: string = '';
    //踩一下次数
    cai: number;
    //赞一下次数
    zan: number;
    //当前房卡数量
    cur: number;
    //玩家总共拥有过的房卡数量
    zong: number;
    //红包现金(单位:分)
    hongbao: number = 0;
    //红包内的金额
    hongbaoMoney: number = 0;
    //红包详情
    hongbaoDetails: any[];


    //玩家IP
    ip: string = "192.168.2.1";
    //实名
    name: string;
    //身份证
    id_no: string;
    //掉线率
    drop_rate: number;
    //游戏次数
    game_times: number;
    //手机认证码(可向服务器查询手机号码)
    gid: number;
    //认证的手机
    phone: number;
    //是否实名认证
    isShiming: boolean = false;
    //是否手机认证
    isVip: boolean = false;


    //位置
    pos: number = -1;
    //状态
    status: string = "";

    //方向
    get dir(): number {
        return PublicVal.i.getDir(this.pos)
    }

    constructor(data: any = null) {
        super();

        if (data) this.update(data);
    }

    update(data: any) {
        super.update(data);

        if (!data) return;

        this.sex = this.sex == Gender.male ? Gender.male : Gender.female;

        if (data.hasOwnProperty('gid')) {
            this.isVip = true;
        }

        if (data.hasOwnProperty('name') && data.hasOwnProperty('id_no')) {
            this.isShiming = true;
        }

        if (GameConfig.isPureness) {
            this.version = 'V1.0.0';
        }
    }

    //设置红包详情
    setHongbaoDetails(data: any[]) {
        data.sort(function (a: any[], b: any[]) {
            return a[3] > b[3] ? -1 : 1;
        });

        for (let i: number = 0; i < data.length; i++) {
            if (data[i][4] == game.player.gid) {
                game.player.hongbaoMoney = +data[i][2];
            }
        }

        this.hongbaoDetails = data;
    }
}